SpatialStream® Code Examples

Query By Street Name

GetQuery function enables advanced spatial and aspatial queries and context queries against SQL based
(transactional) data. Queries include those using inclusion and exclusion geometries, as well as those
using a buffer of a selected feature. Query results can be thematically displayed, just as with any other layer.

In this example, a GetQuery is constructed using Street Name and it is querying the SpatialStream® parcel
layer to obtain all match parcel's geoJson data and highlight them on the map.

GetQuery

function getMapBound(){
var sw = map.getBounds().getSouthWest();
var ne = map.getBounds().getNorthEast();
return ["POLYGON((",sw.lng,' ',sw.lat,',',ne.lng,' ',sw.lat,',',ne.lng,' ',ne.lat,',',sw.lng,' ',ne.lat,',',sw.lng,' ',sw.lat,'))'].join('');
}

//----------------

var url = Dmp.Env.Connections["SS"].getBaseUrl() + "GetQuery.aspx?"
url += "datasource=SAMPLESITE.DMP/PARCELDETAIL"
url += "&maxRecords=-1"
url += "&inclusionGeometries="+getMapBound()
url += "&query=(SITE_STREET_NAME like '" +streetNm + "%25')"
url += "&output=geojson&fields=site_street_name,geometry";

Dmp.Env.Connections["SS"].getJson(url, successCallback, errorCallback);


Run Sample   Back To Index